package asimes.neteasy;

import java.util.ArrayList;
import java.util.Scanner;

/**
 * Created by Liangweiwei on 2016/9/12.
 */
public class Main3 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        int N = scanner.nextInt();
        int[] arr = new int[N];
        for (int i = 0; i < N; i++) {
            arr[i] = scanner.nextInt();
        }
        System.out.println(getMinCount(arr,0));
    }
    public static int getMinCount(int[] arr,int count){
        count++;
        for (int i = 0; i < arr.length-1; i++) {
            int[] tmp = new int[arr.length-1];
            for (int k = 0; k < i; k++) {
                tmp[k] = arr[k];
            }
            tmp[i] = arr[i]+arr[i+1];
            for (int j = i+1; j < arr.length-1; j++) {
                tmp[j] = arr[j+1];
            }
            if (isTrue(tmp)){
                break;
            }
            getMinCount(tmp,count);
        }
        return count;
    }

    public static boolean isTrue(int[] arr){
        int left,right;
        if (arr.length %2 == 1){
            left=arr.length/2-1;
            right=arr.length/2+1;
            while (left>=0 && right < arr.length ){
                if (arr[left] != arr[right]){
                    return false;
                }
                left--;
                right++;
            }
        }else {
            left=arr.length/2-1;
            right=arr.length/2;
            while (left>=0 && right < arr.length ){
                if (arr[left] != arr[right]){
                    return false;
                }
                left--;
                right++;
            }
        }

        return true;
    }

}
